Working with tags

  • STEPS

    Tag is applied when pushing the code to master

    1. create tags

    
                    # lightweight tag 
                    $ git tag v1.0
    
                    OR
    
                    # annotated tag
                    $ git tag -a v1.0 -m "login"
    
                    

    2. list of all tags

    
                    # list all tags
                    $ git tag
    
                    # list all tags with given pattern ex: v-
                    $ git tag --list 'v-*'
    
                    

    3. delete tags

    Delete a local tag
    
                    $ git tag -d <tag_name>
                    Deleted tag <tag_name> (was 000000)
                    
    Delete remote tags
    
                    # Delete a tag from the server with push tags
                    $ git push --delete origin <tag name>
                    

    4. clone a specific tag

    Option 1:
    
                    # Update the local git repo with the latest tags from all remotes
                    $ git fetch --all
    
                    # checkout the specific tag
                    $ git checkout tags/<tag> -b <branch>
                    
    Option 2
    
                    # Clone a specific tag name using git clone 
                    $ git clone <url> --branch=<tag_name>
                    

    5. push tags

    
                    git push origin <tag_name>
    
                    OR
                    
                    git push --tags